	#include <SDKDDKVer.h>

	#include <stdio.h>
	#include <tchar.h>

	#include <cassert>
	#include <string>
	#include <memory>

	#include <iostream>
	#include <ostream>
	#include <sstream>

	#include "../Objectville/Hfdp.h"
	#include "../Objectville/Object.hpp"
	#include "../Objectville/Singleton.hpp";
	#include "../Objectville/Flight.hpp";
	#include "../Objectville/Speech.hpp";
	#include "../Objectville/Fowl.hpp";
	#include "../Objectville/Fowl_factory.hpp"

//
//	Table of Contents; comment-out zero or more of the following #define declarations to exclude its corresponding block (in _tmain) from execution.
//
	#define	_hfdp_cpp_objectville_	// Comment-out this line to exclude 'Objectville' (core)
	#define	_hfdp_cpp_chapter_1_	// Comment-out this line to exclude chapter one (1)

	using namespace std;
	using namespace Hfdp;

	/**
	 *	Main entry point into this program; essentially a large, sequential test suite. In contrast to previous versions,
	 *	which contained numerous projects, one for each pattern, all examples are executed sequentially.  More so,
	 *	I didn't want to introduce a 3rd-party unit test library. After all, the intent is to illustrate C++ principles and best
	 *	practices and patterns from the book, not support a full SDLC (Software Development Life Cycle).
	 */
		int _tmain(int argc, _TCHAR* argv[])
		{
			#if defined(_hfdp_cpp_objectville_)

				Object& object = *(new Object());		// create object and convert to a reference
				Object& object2 = *(new Object());		// create object and convert to a reference

				// asserts reference equality; whereby two objects are equal if they compare semantically as opposed
				// to value equality whereby two objects are equal if the values are the same, like pointers or integers

				assert(object != object2);

			#endif

			#if defined(_hfdp_cpp_chapter_1_) 
				SimUDuck();
			#endif

			return 0;
		}

		/**
		 *	Animates the specified fowl, by serializing it properties and executing its behavior, which
		 *	is captured and serialized to an output stream
		 */
		void animate(ostream& stream, const unique_ptr<Fowl>& fowl)
		{	
			stringstream string;

			string << fowl->get_weight();
			stream << endl;
			stream << fowl->to_string() << " @ " << string.str() << " lbs.";
			stream << endl;
			stream << fowl->fly();
			stream << endl;
			stream << fowl->speak();
			stream << endl;
			stream << fowl->swim();
			stream << endl;
		}

		/**
		 *	'SimUDuck'; simulates a large variety of duck (or fowl) species swimming, flying or otherwise
		 *	make quacking sounds. Exhibits Singleton, Strategy, Factory, Abstract Factory & Template patterns.
		 *
		 *	Book:	Several types of birds and behaviors are mentioned; however, four	types are sufficient
		 *			to illustrate the pattern(s); specifically, Wild turkey, Mallard, Rubber and Decoy ducks. Other
		 *			fowl and behaviors were omitted for brevity and clarity.
		 */	
		void SimUDuck()
		{
			animate(cout, Fowl_factory::instance().make<Fowl_factory::Mallard_duck>());
			animate(cout, Fowl_factory::instance().make<Fowl_factory::Wild_turkey>());
			animate(cout, Fowl_factory::instance().make<Fowl_factory::Rubber_duck>());
			animate(cout, Fowl_factory::instance().make<Fowl_factory::Decoy_duck>());
		}

